﻿using System.Collections.Generic;
using JetBrains.Application.Settings;
using JetBrains.ReSharper.Daemon;
using JetBrains.ReSharper.Daemon.Xml.Stages;
using JetBrains.ReSharper.Daemon.Xml.Stages.Analysis;
using JetBrains.ReSharper.Psi.Xaml.Tree;
using JetBrains.ReSharper.Psi.Xml.Tree;
using JetBrains.Util;

namespace GammaJul.ReSharper.GammaXaml.Analysis.Xaml {

	/// <summary>
	/// Provides XAML analyzers.
	/// </summary>
	[XmlAnalysisProvider]
	internal sealed class XamlAnalysisProvider : IXmlAnalysisProvider {

		public IEnumerable<XmlAnalysis> GetAnalyses(IXmlFile file, IDaemonProcess process, IContextBoundSettingsStore settingsStore) {
			var xamlFile = file as IXamlFile;
			if (xamlFile != null) {
				return new XmlAnalysis[] {
					new CaliburnAnalysis(),
					new GridDefinitionAnalysis(),
					new RedundantNodeAnalysis(),
					new RelativeSourceAnalysis(),
					new UnresolvedElementNameAnalysis()
				};
			}
			return EmptyArray<XmlAnalysis>.Instance;
		}

	}

}